<?php
/*
    Date    |    Name    | Version |    Changes
 11-05-2009 | Tom        | 0.1     | Created this page
 04-06-2009 | Martin Niks | 1.0	   | Refactor
*/
class User {

	private $id;
	private $name;
	private $passwd;
	
	/*
	@param		$id		Id of the user
	@param		$name		Name of the user
	@param		$passwd		Password of the user
	*/
	public function __construct($id, $name, $passwd) {
		$this->id 		= 	$id;
		$this->name 	= 	$name;
		$this->passwd	= 	$passwd;
	}
	
	/*
	@return		$id		The user id
	*/
	public function getId() {
		return $this->id;
	}
	
	/*
	@return		$name		The user name
	*/
	public function getName() {
		return $this->name;
	}
	
	/*
	@return		$passwd		The user password
	*/
	public function getPasswd() {
		return $this->passwd;
	}
	
	/*
	@param		$name			The new user name
	@call		DB::updateUser($this)	Update the user in the database and give this user object
	*/
	public function updateName($name) {
		$this->name 	= 	$name;
		DB::updateUser($this);
	}
	
	/*
	@param		$passwd		The new user password
	@call		DB::updateUser($this)	Update the user in the database and give this user object
	*/
	public function updatePasswd($passwd) {
		$this->passwd 	=	$passwd;
		DB::updateUser($this);
	}
}
